<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Obaju : e-commerce template</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="robots" content="all,follow">
    <!-- Bootstrap CSS-->
    <link rel="stylesheet" href="sourse/vendor/bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome CSS-->
    <link rel="stylesheet" href="sourse/vendor/font-awesome/css/font-awesome.min.css">
    <!-- Google fonts - Roboto -->
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,700">
    <!-- owl carousel-->
    <link rel="stylesheet" href="sourse/vendor/owl.carousel/assets/owl.carousel.css">
    <link rel="stylesheet" href="sourse/vendor/owl.carousel/assets/owl.theme.default.css">
    <!-- theme stylesheet-->
    <link rel="stylesheet" href="sourse/css/style.default.css" id="theme-stylesheet">
    <!-- Custom stylesheet - for your changes-->
    <link rel="stylesheet" href="sourse/css/custom.css">
    <!-- Favicon-->
    <link rel="shortcut icon" href="favicon.png">
    <!-- Tweaks for older IEs--><!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
        <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script><![endif]-->
    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
  </head>
  <body>
    <div id="all">
      <div id="content">
        <div class="container">
          <div class="row">
            <div class="col-lg-3">
              <div class="card sidebar-menu">
                <div class="card-header">
                  <h3 class="h4 card-title">Customer section</h3>
                </div>
                <div class="card-body">
                  <ul class="nav nav-pills flex-column">
                    <a href="customer1" class="nav-link active"><i class="fa fa-list"></i> 我的订单</a>
                    <a href="customer2" class="nav-link active"><i class="fa fa-list"></i> 我的地址</a>
                    <a href="customer3" class="nav-link"><i class="fa fa-user"></i>修改信息</a>
                    <a href="javascript:void(0)" onclick="window.parent.location.href = 'jump'" class="nav-link"><i class="fa fa-sign-out"></i>退出</a>
                  </ul>
                </div>
              </div>
              <!-- /.col-lg-3-->
              <!-- *** CUSTOMER MENU END ***-->
            </div>
            <div id="customer-order" class="col-lg-9">
              <div class="box">
                <h1>订单详情</h1>
                <p class="lead">订单号:${order.oid}<br><strong>创建时间:${order.ocreateDate}</strong><br>状态:
                  <c:if test="${order.ostatus==0}">未支付</c:if><c:if test="${order.ostatus==1}">已支付</c:if>
                  <c:if test="${order.ostatus==2}">已发货</c:if><c:if test="${order.ostatus==3}">已签收</c:if>
                  <c:if test="${order.ostatus==4}">退货</c:if><c:if test="${order.ostatus==5}">已失效</c:if></p>
                <hr>
                <div class="table-responsive mb-4">
                  <table class="table">
                    <thead>
                      <tr>
                        <th colspan="2">商品</th>
                        <th>商品数量</th>
                        <th>单价</th>
                        <th>折扣</th>
                        <th>总价</th>
                      </tr>
                    </thead>
                    <tbody>
                    <c:forEach items="${order.ods}" var="orderdt">
                      <tr>
                        <td><a href="javascript:void(0)" onclick="window.parent.location.href = 'goodsDetails?gid=${orderdt.goods.goodsId}'"><img src="${orderdt.goods.goodsImage}"></a></td>
                        <td><a href="javascript:void(0)" onclick="window.parent.location.href = 'goodsDetails?gid=${orderdt.goods.goodsId}'">${orderdt.goods.goodsName}</a></td>
                        <td>${orderdt.odnumber}</td>
                        <td>￥${orderdt.goods.goodsPrice}</td>
                        <td>￥${orderdt.goods.goodsPrice*orderdt.goods.goodsDiscount}</td>
                        <td>￥${orderdt.odnumber*orderdt.goods.goodsPrice*orderdt.goods.goodsDiscount}</td>
                      </tr>
                    </c:forEach>
                    </tbody>
                    <tfoot>
                      <tr>
                        <th colspan="5" class="text-right">实付</th>
                        <th>￥${newSum}</th>
                      </tr>
                      <tr>
                        <th colspan="5" class="text-right">折扣</th>
                        <th>￥${sum-newSum}</th>
                      </tr>
                      <tr>
                        <th colspan="5" class="text-right">总价</th>
                        <th>￥${sum}</th>
                      </tr>
                    </tfoot>
                  </table>
                </div>
                <!-- /.table-responsive-->
                <div class="row addresses">
                  <c:if test="${order.ostatus==0}">
                    <script type="text/javascript">
                        $("#oid",window.parent.document).attr("name","${order.oid}")
                        $("#fk",window.parent.document).attr("src","checkout4?oid=${order.oid}")
                    </script>
                    <div class="col-lg-6">
                      <h2>还有</h2>
                      <p id="miaoshu"></p>秒后失效<br>
                      <button onclick="window.parent.ShowDiv('MyDiv','fade')">去支付</button>
                    </div>
                    <script type="text/javascript">
                        var oldsj = new Date("${order.ocreateDate}");
                        oldsj.setTime(oldsj.getTime()+30*60*1000);
                        var newsj = new Date();
                        var s;
                        console.info(oldsj)
                        if(oldsj.getTime()>newsj.getTime()){
                            var a = setInterval(function () {
                                  newsj = new Date();
                                  s = (oldsj.getTime()- newsj.getTime())/1000;
                                  s = Math.ceil(s);
                                  console.info(s)
                                  $("#miaoshu").text(s)
                                  if(s <= 0){
                                    $("#miaoshu").text("0")
                                      location.reload();
                                     clearInterval(s)
                                  }
                           },1000)
                        }
                    </script>
                  </c:if>
                  <div class="col-lg-6">
                    <h2>收货地址信息</h2>
                    <p>收货人:${order.address.name}<br>手机号:${order.address.phone}<br>地址:${order.address.path}<br>详细地址:${order.address.userAddress}</p>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <!-- *** COPYRIGHT END ***-->
    <!-- JavaScript files-->
    <script src="sourse/vendor/jquery/jquery.min.js"></script>
    <script src="sourse/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
    <script src="sourse/vendor/jquery.cookie/jquery.cookie.js"> </script>
    <script src="sourse/vendor/owl.carousel/owl.carousel.min.js"></script>
    <script src="sourse/vendor/owl.carousel2.thumbs/owl.carousel2.thumbs.js"></script>
    <script src="sourse/js/front.js"></script>
  </body>
</html>